package com.datastructure.test.recall.arrayoftotal.self;

import java.util.ArrayList;
import java.util.Deque;
import java.util.List;

public class TotalOfArraySum {

    public static void main(String[] args) {

    }

    private void getTotalOfArraySum(int target, int [] data, int start, List<List<Integer>> result,Deque<Integer> deque){
        if(target<0){
            return;
        }
        if(target == 0){
            result.add(new ArrayList<>(deque));
            return;//遗忘掉了
        }
        for (int i = start; i < data.length; i++) {
            deque.add(data[i]);
            getTotalOfArraySum(target-data[i],data,i,result,deque);
            deque.removeLast();
        }
    }
}
